function view_report_info(id,status) {
    if(status == 0){
        window.open("/user/get-save-report?rid="+id+"&status="+status+"&ten="+localStorage.getItem("token"));
        // window.location.href = "/user/get-save-report?rid="+id+"&status="+status+"&ten="+localStorage.getItem("token");
        return false;
    };
    if(status == 1 || status == 3 || status == 5){
        window.open("/user/get-save-report?rid="+id+"&status="+status+"&ten="+localStorage.getItem("token"));
        // window.location.href = "/user/get-save-report?rid="+id+"&status="+status+"&ten="+localStorage.getItem("token");
        return false;
    }
    $.ajax({
        beforeSend: function (request) {
            request.setRequestHeader("uid", localStorage.getItem("token"));
        },
        url: "/user/get?rid="+id,
        type:"get",
        contentType: 'application/json',
        success: function (data) {
            if(data.code != 200){
                alert("请求失败！");
                return false;
            }
            var obj = data.data;
            $("#reportId").text(obj.reportId);
            $("#reportNumber").text(obj.reportNumber);
            $("#checkDate").text(obj.checkDate);
            $("#checkMethod").text(obj.checkMethod);
            $("#checkMethod2").text(obj.checkMethod);
            // $("#basisStandard").text(obj.basisStandard);
            $("#organizationAddress").text(obj.organizationAddress);
            $("#agentName").text(obj.agentName);
            $("#agentPhone").text(obj.agentPhone);
            $("#agentAddress").text(obj.agentAddress);
            $("#equipmentManufacturer").text(obj.equipmentManufacturer);
            $("#engineManufacturerName").text(obj.engineManufacturerName);
            $("#machineProtectionNumber").text(obj.machineProtectionNumber);
            $("#machineNumber").text(obj.machineNumber);
            $("#equipmentNumber").text(obj.equipmentNumber);
            $("#machineName").text(obj.machineName);
            $("#trademark").text(obj.trademark);
            $("#productionDate").text(obj.productionDate);
            $("#equipmentColor").text(obj.equipmentColor);
            $("#emissionWarranty").text(obj.emissionWarranty);
            $("#checkBasis").text(obj.checkBasis);
            $("#machineVin").text(obj.machineVin);
            $("#engineNumber").text(obj.engineNumber);
            $("#engineModel").text(obj.engineModel);
            $("#emissionPeriod").text(obj.emissionPeriod);
            $("#engineYear").text(obj.engineYear);
            $("#enginePower").text(obj.enginePower);
            $("#engineOils").text(obj.engineOils);
            $("#engineSpeed").text(obj.engineSpeed);
            $("#protectionNumber").text(obj.protectionNumber);
            $("#engineTypeApprovalNumber").text(obj.engineTypeApprovalNumber);
            $("#machineType").text(obj.machineType);
            $("#checkType").text(obj.checkType);
            $("#workCharacteristic").text(obj.workCharacteristic);
            $("#engineAftertreatmentSystem").text(obj.engineAftertreatmentSystem);
            $("#banBlowdownRegion").text(obj.banBlowdownRegion);
            $("#driverAlarmSystem").text(obj.driverAlarmSystem);
            $("#driverPerformanceRestrictionSystem").text(obj.driverPerformanceRestrictionSystem);
            $("#ecuInfo").text(obj.ecuInfo);
            $("#remoteMonitorSystem").text(obj.remoteMonitorSystem);
            $("#satellitePositionSystem").text(obj.satellitePositionSystem);
            $("#ambientTemperature").text(obj.ambientTemperature);
            $("#altitude").text(obj.altitude);
            $("#ambientHumidity").text(obj.ambientHumidity);
            $("#atmosphericPressure").text(obj.atmosphericPressure);
            $("#equipmentName").text(obj.equipmentName);
            $("#equipmentModel").text(obj.equipmentModel);
            $("#equipmentFactoryNumber").text(obj.equipmentFactoryNumber);
            $("#equipmentMeasurementCertificate").text(obj.equipmentMeasurementCertificate);
            $("#checkStartTime").text(obj.checkStartTime);
            $("#checkEndTime").text(obj.checkEndTime);
            $("#checkPlace").text(obj.checkPlace);
            $("#checkResult1").text(obj.checkResult1);
            $("#checkResult2").text(obj.checkResult2);
            $("#checkResult3").text(obj.checkResult3);
            $("#checkEngineSpeed").text(obj.checkEngineSpeed);
            if(Number(obj.visualPlume) == 0){
                $("#visualPlume").text("不可见");
            }else{
                $("#visualPlume").text("可见");
            }
            $("#accelerateResult").text(obj.accelerateResult);
            $("#emissionLimits").text(obj.emissionLimits);
            $("#resultJudgment").text(obj.resultJudgment);
            $("#fpic1").attr("src",obj.fpic1);
            $("#fpic2").attr("src",obj.fpic2);
            $("#fpic3").attr("src",obj.fpic3);
            $("#fpic4").attr("src",obj.fpic4);
            $("#fpic5").attr("src",obj.fpic5);
            $("#fpic6").attr("src",obj.fpic6);
            $("#fpic7").attr("src",obj.fpic7);
            $("#fpic8").attr("src",obj.fpic8);
            $("#fpic9").attr("src",obj.fpic9);
            $("#fpic10").attr("src",obj.fpic10);
            $("#report_modal").modal("show");
        }
    });
}

$("#modify_report").click(function () {
    //后端只有这一个是存的Integer类型 , 暂时先不该成String
    var vp = 1;
    if($("#visualPlume").text().trim() == "不可见"){
        vp = 0;
    }
    var json_data = JSON.stringify({
        reportId: $("#reportId").text().trim(),
        reportNumber: $("#reportNumber").text().trim(),
        checkDate: $("#checkDate").text().trim(),
        checkMethod: $("#checkMethod").text().trim(), //因为select 所以要获取其val
        // basisStandard : $("#basisStandard").text().trim(),
        // checkOrganization: $("#checkOrganization").text().trim(),
        organizationAddress: $("#organizationAddress").text().trim(),
        agentName: $("#agentName").text().trim(),
        agentPhone: $("#agentPhone").text().trim(),
        agentAddress: $("#agentAddress").text().trim(),
        equipmentManufacturer: $("#equipmentManufacturer").text().trim(),
        engineManufacturerName: $("#engineManufacturerName").text().trim(),
        machineProtectionNumber: $("#machineProtectionNumber").text().trim(),
        machineNumber: $("#machineNumber").text().trim(),
        equipmentNumber: $("#equipmentNumber").text().trim(),
        machineName: $("#machineName").text().trim(),
        trademark: $("#trademark").text().trim(),
        productionDate: $("#productionDate").text().trim(),
        equipmentColor: $("#equipmentColor").text().trim(),
        emissionWarranty: $("#emissionWarranty").text().trim(),
        checkBasis: $("#checkBasis").text().trim(),
        machineVin: $("#machineVin").text().trim(),
        engineNumber: $("#engineNumber").text().trim(),
        engineModel: $("#engineModel").text().trim(),
        emissionPeriod: $("#emissionPeriod").text().trim(),  //因为是radio 获取radio
        engineYear: $("#engineYear").text().trim(),
        enginePower: $("#enginePower").text().trim(),
        engineSpeed: $("#engineSpeed").text().trim(),
        engineOils: $("#engineOils").text().trim(),
        protectionNumber: $("#protectionNumber").text().trim(),
        engineTypeApprovalNumber: $("#engineTypeApprovalNumber").text().trim(),
        machineType: $("#machineType").text().trim(),
        checkType: $("#checkType").text().trim(),
        workCharacteristic: $("#workCharacteristic").text().trim(),
        engineAftertreatmentSystem: $("#engineAftertreatmentSystem").text().trim(),
        banBlowdownRegion: $("#banBlowdownRegion").text().trim(),
        driverAlarmSystem: $("#driverAlarmSystem").text().trim(),
        driverPerformanceRestrictionSystem: $("#driverPerformanceRestrictionSystem").text().trim(),
        ecuInfo: $("#ecuInfo").text().trim(),
        remoteMonitorSystem: $("#remoteMonitorSystem").text().trim(),
        satellitePositionSystem: $("#satellitePositionSystem").text().trim(),
        ambientTemperature: $("#ambientTemperature").text().trim(),
        altitude: $("#altitude").text().trim(),
        ambientHumidity: $("#ambientHumidity").text().trim(),
        atmosphericPressure: $("#atmosphericPressure").text().trim(),
        equipmentName: $("#equipmentName").text().trim(),
        equipmentModel: $("#equipmentModel").text().trim(),
        equipmentFactoryNumber: $("#equipmentFactoryNumber").text().trim(),
        equipmentMeasurementCertificate: $("#equipmentMeasurementCertificate").text().trim(),
        checkStartTime: $("#checkStartTime").text().trim(),
        checkEndTime: $("#checkEndTime").text().trim(),
        checkPlace: $("#checkPlace").text().trim(),
        checkResult1: $("#checkResult1").text().trim(),
        checkResult2: $("#checkResult2").text().trim(),
        checkResult3: $("#checkResult3").text().trim(),
        checkEngineSpeed: $("#checkEngineSpeed").text().trim(),
        visualPlume: vp,
        accelerateResult: $("#accelerateResult").text().trim(),
        emissionLimits: $("#emissionLimits").text().trim(),
        resultJudgment: $("#resultJudgment").text().trim(),
    });
    console.log(json_data);
    $.ajax({
        beforeSend: function (request) {
            request.setRequestHeader("uid", localStorage.getItem("token"));
        },
        url: "/user/modify-report",
        type: "post",
        contentType: "application/json;charset=utf-8",
        data: json_data,
        dateType: "json",
        success: function (data) {
            if(data.code == 200){
                $("#dataTable").DataTable().ajax.reload();
            }
            alert(data.message);
        }
    })
});